#include "Samples.h"

Samples::Samples(void)
{
}

Samples::~Samples(void)
{
}

int main(int argc, char **argv)
{
	Samples samples;
	int option = samples.readOption();
	samples.runSample(option);

	return 0;
}

int Samples::readOption()
{
	cout << "Select the sample to run:" << endl;
	cout << " 1) Create an SDL window" << endl;
	cout << " 2) Create an SDL Textbox" << endl;
	cout << " 3) Draw a rectangle (SDL)" << endl;
	cout << " 4) Draw pixels (SDL)" << endl;
	cout << " 5) Parse XML with SAX (Xerces-C)" << endl;
	cout << " 6) Move a rectangle using mouse (SDL)" << endl;
	cout << " 7) Pixels follow the mouse (SDL)" << endl;
	cout << " 8) Draw lines (SDL)" << endl;
	cout << " 9) Lines follow mouse click (SDL)" << endl;
	cout << "10) Draw filled Polygons (SDL)" << endl;
	cout << "To quit, any other key" << endl;

	int option;
	cin >> option;

	return option;
}

void Samples::runSample(int option)
{
	if (option == 1)
	{
		CreateWindow window;
		window.run();
	}
	else if (option == 2)
	{
		CreateTextbox textbox;
		textbox.run();
	}
	else if (option == 3)
	{
		DrawRectangle rectangle;
		rectangle.run();
	}
	else if (option == 4)
	{
		DrawPixels pixels;
		pixels.run();
	}
	else if (option == 5)
	{
		ParseXML xmlParser;
		xmlParser.run();
	}
	else if (option == 6)
	{
		MouseObject mouseRect;
		mouseRect.run();
	}
	else if (option == 7)
	{
		PixelsFollowMouse pixelsFollowMouse;
		pixelsFollowMouse.run();
	}
	else if (option == 8)
	{
		DrawLines drawLines;
		drawLines.run();
	}
	else if (option == 9)
	{
		LinesFollowMouseClick linesFollowMouseClick;
		linesFollowMouseClick.run();
	}
	else if (option == 10)
	{
		FilledPolygons filledPolygons;
		filledPolygons.run();
	}
	else
	{
		exit(0);
	}
}
